﻿namespace BLL.Repositories.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class init : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Users",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        Password = c.String(),
                        Code = c.String(),
                        VerifyPassword = c.String(),
                        InvitedBy_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Users", t => t.InvitedBy_Id)
                .Index(t => t.InvitedBy_Id);
            
            CreateTable(
                "dbo.Articles",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Title = c.String(),
                        Description = c.String(),
                        Default = c.String(),
                        Abstract = c.String(),
                        Keyword = c.String(),
                        Text = c.String(),
                        Link = c.String(),
                        AD = c.String(),
                        Author_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Users", t => t.Author_Id)
                .Index(t => t.Author_Id);
            
            CreateTable(
                "dbo.Contacts",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        QQ = c.Int(),
                        WeChat = c.String(),
                        Tel = c.Int(),
                        SelfDescription = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.Logs",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        Password = c.String(),
                        Code = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.MoneyTrades",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Buyer = c.String(),
                        Amount = c.Int(nullable: false),
                        Price = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.Passwords",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Email = c.String(),
                        Name = c.String(),
                        Code = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.Plans",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Title = c.String(),
                        Label = c.String(),
                        BangMoney = c.Int(),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.Profiles",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        BirthYear = c.Int(nullable: false),
                        BirthMonth = c.Int(nullable: false),
                        Constellation = c.String(),
                        First = c.String(),
                        Secend = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.Articles", "Author_Id", "dbo.Users");
            DropForeignKey("dbo.Users", "InvitedBy_Id", "dbo.Users");
            DropIndex("dbo.Articles", new[] { "Author_Id" });
            DropIndex("dbo.Users", new[] { "InvitedBy_Id" });
            DropTable("dbo.Profiles");
            DropTable("dbo.Plans");
            DropTable("dbo.Passwords");
            DropTable("dbo.MoneyTrades");
            DropTable("dbo.Logs");
            DropTable("dbo.Contacts");
            DropTable("dbo.Articles");
            DropTable("dbo.Users");
        }
    }
}
